package itheima.com.MapTest;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.stream.Stream;

public class StreamDemo01 {
    public static void main(String[] args) {
//        method01();
//        method02();
//        method03();
        Stream.of(1,2,3,4,5,6,7).forEach(s->{
            System.out.println(s);
        });

    }

    private static void method03() {
        int[] arr = {1, 2, 3, 4, 5, 6, 7};
        Arrays.stream(arr).forEach(s->{
            System.out.println(s);
        });
    }

    private static void method02() {
        HashMap<String, Integer> hm = new HashMap<>();
        hm.put("小虎", 24);
        hm.put("小牛", 24);
        hm.put("小龙", 24);
        hm.put("小雅", 24);

        hm.keySet().stream().forEach(s -> {
            System.out.println(s);
        });

        hm.entrySet().stream().forEach(s -> {
            System.out.println(s);
        });
    }

    private static void method01() {
        ArrayList<String> list = new ArrayList<>();
        list.add("aa");
        list.add("bb");
        list.add("cc");

        list.stream().forEach(s -> {
            System.out.println(s);
        });
    }
}
